
SET(LIBMV_AUTHORS "Libmv Team.")

SET(CPACK_PACKAGE_NAME "libmv")
SET(CPACK_PACKAGE_VERSION ${LIBMV_VERSION})
SET(CPACK_PACKAGE_VERSION_MAJOR ${LIBMV_VERSION_MAJOR})
SET(CPACK_PACKAGE_VERSION_MINOR ${LIBMV_VERSION_MINOR})
SET(CPACK_PACKAGE_VERSION_PATCH ${LIBMV_VERSION_PATCH})

# The libmv binary package must contain: bin/ lib/*.so(dll)
IF (WIN32)
  SET(CPACK_GENERATOR "NSIS")
ELSE (WIN32)
  SET(CPACK_GENERATOR "TBZ2;DEB;RPM")
ENDIF(WIN32)
SET(CPACK_IGNORE_FILES  ".svn/;.kdev4/;build/;bin-opt/;bin-dbg/;~$;${CPACK_SOURCE_IGNORE_FILES}")
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${LIBMV_VERSION}_${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")

# The libmv source package must contain: binary + src/ lib/*.a(lib) contrib/ extras/ doc/ ?
IF (WIN32)
  SET(CPACK_SOURCE_GENERATOR "ZIP")
ELSE (WIN32)
  SET(CPACK_SOURCE_GENERATOR "TBZ2;DEB;RPM")
ENDIF(WIN32)
SET(CPACK_SOURCE_IGNORE_FILES  ".svn/;.kdev4/;build/;bin-opt/;bin-dbg/;bin/;~$;${CPACK_SOURCE_IGNORE_FILES}")
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${LIBMV_VERSION}-dev")

# SET(CPACK_PACKAGE_EXECUTABLES "the_tools;Tool description")

SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.3.6), libgcc1 (>= 1:4.1)")
# TODO(julien) add third_parties: libpthread-stubs0, libjpeg62, (zlib?, png?) 

SET(CPACK_INSTALL_CMAKE_PROJECTS "${CMAKE_BINARY_DIR};${CMAKE_PROJECT_NAME};ALL;/")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "Libmv ${LIBMV_VERSION_MAJOR}.${LIBMV_VERSION_MINOR}")
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "Libmv ${LIBMV_VERSION}")

SET(CPACK_PACKAGE_DESCRIPTION "A Structure from Motion library")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A Structure from Motion library")

SET(CPACK_PACKAGE_CONTACT "${LIBMV_AUTHORS} <http://code.google.com/p/libmv>")
SET(CPACK_PACKAGE_VENDOR ${LIBMV_AUTHORS})

SET(CPACK_RESOURCE_FILE_LICENSE "${LIBMV_SOURCE_DIR}/../LICENSE")
SET(CPACK_RESOURCE_FILE_README "${LIBMV_SOURCE_DIR}/../README")

ADD_CUSTOM_TARGET(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)

INCLUDE(CPack)

# #set(CPACK_PACKAGE_ICON "${LIBMV_SOURCE_DIR}\\\\libmv-logo.png")
SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "WriteRegStr \\\${WriteEnvStr_RegKey} \\\"LIBMV_HOME\\\" $INSTDIR")

# TODO(julien) Bundle (Mac OS)

# see http://www.cmake.org/Wiki/CMake:CPackPackageGenerators
